<template>
  <transition name="el-zoom-in-center">
    <div class="JNPF-preview-main">
      <Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false"/>
      <div class="JNPF-common-page-header">
        <el-page-header @back="goBack" content="详情"/>
        <div class="options">
          <el-button type="primary" @click="goBack">取 消</el-button>
        </div>
      </div>
      <el-row :gutter="60" class="main" :style="{margin: '0 auto',width: '100%'}">
        <el-form ref="formRef" :model="dataForm" :rules="dataRule" size="medium" label-width="100px" label-position="top">
          <template v-if="!loading">
            <el-col :span="4">
              <el-row :gutter="30">
                <el-col :span="24">
                  <jnpf-form-tip-item label-width="0">
                    <JnpfText
                      :textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":12,"line-height":32,"font-style":"normal","text-align":"left"}'
                      :closable="false">
                    </JnpfText>
                  </jnpf-form-tip-item>
                </el-col>
              </el-row>
            </el-col>
            <el-col :span="16" class="project-main">
              <el-row :gutter="30">
                <el-col :span="24">
                  <jnpf-form-tip-item label-width="0">
                    <JnpfText
                      :textStyle='{"color":"#1684FC","font-weight":"bold","text-decoration":"none","font-size":24,"line-height":32,"font-style":"normal","text-align":"center"}'
                      :closable="false" content="数字化改造验收">
                    </JnpfText>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="12">
                  <jnpf-form-tip-item label="企业名称" prop="enterpriseName">
                    <p>{{ dataForm.enterpriseName }}</p>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="12">
                  <jnpf-form-tip-item label="企业信用代码" label-width="125px" prop="enterpriseCreditCode">
                    <p>{{ dataForm.enterpriseCreditCode }}</p>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="项目名称" prop="projectNames">
                    <p>{{ dataForm.projectNames }}</p>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="数字化改造项目服务合同（盖章扫描版） " prop="digitalProjectContract">
                    <div v-for="item in dataForm.digitalProjectContract" class="file-main">
                      <label>{{ item.projectName }} ：</label>
                      <JnpfUploadFile v-model="item.projectFiles"
                                      disabled
                                      detailed :fileSize="10" sizeUnit="MB" :limit="9" pathType="defaultPath"
                                      :isAccount="0" buttonText="点击上传">
                      </JnpfUploadFile>
                    </div>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="数字化改造项目方案（盖章扫描版） " prop="digitalProjectPlan">
                    <div v-for="item in dataForm.digitalProjectPlan" class="file-main">
                      <label>{{ item.projectName }} ：</label>
                      <JnpfUploadFile v-model="item.projectFiles"
                                      disabled
                                      detailed :fileSize="10" sizeUnit="MB" :limit="9" pathType="defaultPath"
                                      :isAccount="0" buttonText="点击上传">
                      </JnpfUploadFile>
                    </div>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="项目投资发票和付款凭证等交易记录（扫描版）" prop="transactionRecords">
                    <JnpfUploadFile v-model="dataForm.transactionRecords"
                                    disabled
                                    detailed accept=".pdf" :fileSize="200" sizeUnit="MB" :limit="1"
                                    pathType="defaultPath" :isAccount="0" buttonText="点击上传">
                    </JnpfUploadFile>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="《福州市中小企业数字化转型被改造试点企业项目验收申请函》（盖章扫描版，详见附件)" prop="scanningCopy">
                    <JnpfUploadFile v-model="dataForm.scanningCopy"
                                    disabled
                                    detailed accept=".pdf" :fileSize="200" sizeUnit="MB" :limit="2"
                                    pathType="defaultPath" :isAccount="0" buttonText="点击上传">
                    </JnpfUploadFile>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24">
                  <JnpfDivider contentPosition="center">
                  </JnpfDivider>
                </el-col>
                <el-col :span="24">
                  <jnpf-form-tip-item label="验收结果建议" prop="acceptIspass">
                    <p>{{ dataForm.acceptIspass }} </p>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24" v-if="dataForm.acceptIspass==='建议整改'">
                  <jnpf-form-tip-item label="整改意见" prop="rectificationOpinions">
                    <p>{{ dataForm.rectificationOpinions }}</p>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="12"  v-if="dataForm.acceptIspass==='建议通过'">
                  <jnpf-form-tip-item label="改造后数字化水平等级 " prop="digitizationLevel">
                    <p>{{ dataForm.digitizationLevel }} </p>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24"  v-if="dataForm.acceptIspass==='建议通过'">
                  <jnpf-form-tip-item label="企业数字化改造项目成效验收报告 " prop="performanceAcceptanceReport">
                    <JnpfUploadFile v-model="dataForm.performanceAcceptanceReport"
                                    disabled
                                    detailed :fileSize="50" sizeUnit="MB" :limit="1" pathType="defaultPath"
                                    :isAccount="0" buttonText="点击上传">
                    </JnpfUploadFile>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="24"  v-if="dataForm.acceptIspass==='建议通过'">
                  <jnpf-form-tip-item label="企业数字化水平评测报告 " prop="digitalEvaluationReport">
                    <JnpfUploadFile v-model="dataForm.digitalEvaluationReport"
                                    disabled
                                    detailed :fileSize="50" sizeUnit="MB" :limit="1" pathType="defaultPath"
                                    :isAccount="0" buttonText="点击上传">
                    </JnpfUploadFile>
                  </jnpf-form-tip-item>
                </el-col>
<!--                <el-col :span="12">
                  <jnpf-form-tip-item label="市局待办情况" prop="todoStatus">
                    <p>{{ dataForm.todoStatus }} </p>
                  </jnpf-form-tip-item>
                </el-col>
                <el-col :span="12">
                  <jnpf-form-tip-item label="市局确认状态" prop="confirmStatus">
                    <p>{{ dataForm.confirmStatus }} </p>
                  </jnpf-form-tip-item>
                </el-col>-->
              </el-row>
            </el-col>
            <el-col :span="4">
              <el-row :gutter="30">
                <el-col :span="24">
                  <jnpf-form-tip-item label-width="0">
                    <JnpfText
                      :textStyle='{"color":"#000000","font-weight":"normal","text-decoration":"none","font-size":12,"line-height":32,"font-style":"normal","text-align":"left"}'
                      :closable="false">
                    </JnpfText>
                  </jnpf-form-tip-item>
                </el-col>
              </el-row>
            </el-col>
          </template>
        </el-form>
      </el-row>
    </div>
  </transition>
</template>
<script>
import request from '@/utils/request'

import {getConfigData} from '@/api/onlineDev/visualDev'
import jnpf from '@/utils/jnpf'
import Detail from '@/views/basic/dynamicModel/list/detail'
import {thousandsFormat} from "@/components/Generator/utils/index"

export default {
  components: {Detail},
  props: [],
  data() {
    return {
      visible: false,
      detailVisible: false,
      loading: false,
      dataForm: {
        id: '',
        enterpriseName: '',
        enterpriseCreditCode: '',
        county: "",
        phone: '',
        projectId: '',
        projectNames: '',
        digitalProjectContract: [],
        digitalProjectPlan: [],
        transactionRecords: [],
        scanningCopy: [{
          "fileSize": 13824,
          "fileExtension": "docx",
          "name": "福州市中小企业数字化转型被改造试点企业项目验收申请函模板.docx",
          "url": "/api/file/Image/annex/6673de2e60b2091fb22ee52a.docx",
          "fileId": "6673de2e60b2091fb22ee52a.docx"
        }],
        isconfirm: "0",
        confirmtime: '',
        acceptIspass: '',
        rectificationOpinions: '',
        digitizationLevel: "",
        performanceAcceptanceReport: [],
        digitalEvaluationReport: [],
        todoStatus: "",
        confirmStatus: "",
        isNew : '',
        version : '',
        remarks: '',
        status: "",
        creatoruserid: "",
        creatortime: "",
        lastmodifyuserid: "",
        lastmodifytime: "",
      },
      dataRule:
        {
          enterpriseName: [
            {
              required: true,
              message: '自动填充不可修改',
              trigger: 'blur'
            },
          ],
          enterpriseCreditCode: [
            {
              required: true,
              message: '自动填充不可修改',
              trigger: 'blur'
            },
          ],
          county: [
            {
              required: true,
              message: '请选择',
              trigger: 'change'
            },
          ],
          projectId: [
            {
              required: true,
              message: '自动填充不可修改',
              trigger: 'blur'
            },
          ],
          projectNames: [
            {
              required: true,
              message: '自动填充不可修改',
              trigger: 'blur'
            },
          ],
          digitalProjectContract: [
            {
              required: true,
              message: '请至少选择一个',
              trigger: 'change'
            },
          ],
          digitalProjectPlan: [
            {
              required: true,
              message: '请至少选择一个',
              trigger: 'change'
            },
          ],
          transactionRecords: [
            {
              required: true,
              message: '请至少选择一个',
              trigger: 'change'
            },
          ],
          scanningCopy: [
            {
              required: true,
              message: '请至少选择一个',
              trigger: 'change'
            },
          ],
          isconfirm: [
            {
              required: true,
              message: '请至少选择一个',
              trigger: 'change'
            },
          ],
          acceptIspass: [
            {
              required: true,
              message: '不能为空',
              trigger: 'change'
            },
          ],
          rectificationOpinions: [
            {
              required: true,
              message: '不能为空',
              trigger: 'change'
            },
          ],
          digitizationLevel: [
            {
              required: true,
              message: '请至少选择一个',
              trigger: 'change'
            },
          ],
          performanceAcceptanceReport: [
            {
              required: true,
              message: '不能为空',
              trigger: 'change'
            },
          ],
          digitalEvaluationReport: [
            {
              required: true,
              message: '不能为空',
              trigger: 'change'
            },
          ],
        },
      countyOptions: [{"fullName": "鼓楼区", "id": "鼓楼区"}, {"fullName": "台江区", "id": "台江区"}, {
        "fullName": "仓山区",
        "id": "仓山区"
      }, {"fullName": "马尾区", "id": "马尾区"}, {"fullName": "晋安区", "id": "晋安区"}, {
        "fullName": "长乐区",
        "id": "长乐区"
      }, {"fullName": "闽侯县", "id": "闽侯县"}, {"fullName": "连江县", "id": "连江县"}, {
        "fullName": "罗源县",
        "id": "罗源县"
      }, {"fullName": "闽清县", "id": "闽清县"}, {"fullName": "永泰县", "id": "永泰县"}, {
        "fullName": "福清市",
        "id": "福清市"
      }, {"fullName": "高新区", "id": "高新区"}],
      countyProps: {"label": "fullName", "value": "id"},
      isconfirmOptions: [{"fullName": "确认", "id": "1"}, {"fullName": "未确认", "id": "0"}],
      isconfirmProps: {"label": "fullName", "value": "id"},
      acceptIspassOptions: [{"fullName": "建议通过", "id": "1"}, {"fullName": "建议整改", "id": "0"}],
      acceptIspassProps: {"label": "fullName", "value": "id"},
      digitizationLevelOptions: [{"fullName": "无等级", "id": "0"}, {"fullName": "一级", "id": "1"}, {
        "fullName": "二级",
        "id": "2"
      }, {"fullName": "三级", "id": "3"}, {"fullName": "四级", "id": "4"}],
      digitizationLevelProps: {"label": "fullName", "value": "id"},
      todoStatusOptions: [{"fullName": "整改", "id": "整改"}, {"fullName": "待办", "id": "待办"}, {
        "fullName": "已办",
        "id": "已办"
      }],
      todoStatusProps: {"label": "fullName", "value": "id"},
      confirmStatusOptions: [{"fullName": "同意", "id": "同意"}, {"fullName": "退回", "id": "退回"}],
      confirmStatusProps: {"label": "fullName", "value": "id"},
      statusOptions: [{"fullName": "已审核", "id": "2"}, {"fullName": "审核中", "id": "1"}, {"fullName": "等待提交", "id": "0"}],
      statusProps: {"label": "fullName", "value": "id"},

    }
  },
  computed: {},
  watch: {},
  created() {

  },
  mounted() {
  },
  methods: {
    toDetail(defaultValue, modelId) {
      if (!defaultValue) return
      getConfigData(modelId).then(res => {
        if (!res.data || !res.data.formData) return
        let formData = JSON.parse(res.data.formData)
        formData.popupType = 'general'
        this.detailVisible = true
        this.$nextTick(() => {
          this.$refs.Detail.init(formData, modelId, defaultValue)
        })
      })
    },
    dataInfo(dataAll) {
      let _dataAll = dataAll
      this.dataForm = _dataAll
    },

    goBack() {
      this.$emit('refresh')
    },
    init(id) {
      this.dataForm.id = id || 0;
      this.visible = true;
      this.$nextTick(() => {
        if (this.dataForm.id) {
          this.loading = true
          request({
            url: '/api/example/Fz_completed_acceptance_enterprise/detail/' + this.dataForm.id,
            method: 'get'
          }).then(res => {
            this.dataInfo(res.data)
            this.loading = false
          })
        }

      })
    },
  },
}

</script>
<style lang="scss" scoped>
.main .project-main {
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1) !important;
  border: 1px solid #EBEEF5;
  padding: 20px;
  border-radius: 5px;
}

.file-main {
  display: flex;
  flex-direction: row;

  label {
    color: #606266;
    font-size: 14px;
  }
}
</style>
